home *** CD-ROM | disk | FTP | other *** search
- /* program found in MW-C ref.handbook pp.355-358 */
- /* corrected using tip ; set XDDA @ 0x8000 before each use of linea8() ; */
- /*
- / module name linea8;tip from "The ATARI St Explored",J.Braga,1986,p.199
- .comm la_init_,16
- .shri
- .globl linea8_
- linea8_:
- movea.l la_init_+4,a0
- move $-32768, 64(a0) / preset XDDA BEFORE EACH USE
- .word 0xa008
- rts
- */
- #include <stdio.h> /* include header files */
- #include <osbind.h> /* for use of Getrez() */
- #include <linea.h> /* for use of linea0() */
- struct la_font *fontp; /* font pointer for linea interface */
- char line[100], *p;
- char scr_wrk[2048]; /* area for graphics;double / mono */
- int scr_fat, scr_chi; /* length and disp. for underline */
- /* FUNCTION put a character on the screen */
- put_scr( c, x, y, mode) int c,x,y,mode ;
- /* where int c character to put out */
- /* int x, y x - y coordinates on 80*25 screen */
- /* int mode * 0 normal */
- /* * 1 thicken
- * 2 grey
- * ...
- * 4 italic
- * ...
- * 8 outline
- * ...
- * 16 reverse
- * ...
- * 32 underline */
- {
- unsigned int tmp;
- static long patmsk = -1;
- tmp = c - fontp->font_low_ade;
- DELX = fontp->font_char_off[tmp+1] -
- (SRCX = fontp->font_char_off[tmp]);
- DSTX = x ;
- DSTY = y ;
- WMODE = 0; /* replace mode */
- STYLE = ( mode & 7 );
- if(mode & 8)
- { /* reverse */
- X2 = (X1 = DSTX) + scr_fat;
- Y2 = (Y1 = DSTY) + scr_chi;
- PATPTR = & patmsk;
- PATMSK = 1;
- CLIP = 0;
- linea5(); /*filled rectangle*/
- WMODE = 2; /* xor mode */
- }
- if (mode & 16)
- { /* underline */
- X2 = (X1 = DSTX) + scr_fat;
- Y2 = Y1 = DSTY + scr_chi;
- linea8();
- LNMASK = -1;
- WMODE = 2;
- linea3();
- }
- else
- linea8();
- }
-
- /* FUNCTION initialize stuff for screen */
- init_scr()
- {
- linea0(); /* initialize linea */
- lineaa(); /* hide mouse */
- if( 2 == Getrez())
- {
- fontp = la_init.li_a1[2]; /* 8x16 system font */
- }
- else
- {
- fontp = la_init.li_a1[1]; /* 8x8 system font */
- }
- FBASE = fontp->font_data;
- FWIDTH = fontp->font_width;
- TEXTFG = 1; /* text foreground white */
- SRCY = 0;
- DELY = fontp->font_height;
- scr_fat = fontp->font_fatest;
- scr_chi = fontp->font_height - 1;
- COLBIT0 = 1;
- COLBIT1 = 0;
- COLBIT2 = 0;
- COLBIT3 = 0;
- /* XDDA = 0x8000;Use new linea8 to set xaccdda to 0x8000 before each #8*/
- LITEMSK = 0x5555;
- SKEWMSK = 0x1111;
- SCRTCHP = scr_wrk;
- WEIGHT = 1;
- LSTLIN = -1;
- }
-
- init_msg()
- {
- printf("\033EProgram to demonstrate some linea capabilities;MWC-CJP OCT'86\n");
- printf(" (Each line should have four decimal numbers or'quit') \n");
- printf("The decimal ASCII value of the character 'A'==65, etc., \n");
- printf("The X and Y coordinates:640x400,640x200,320x200 rez.screen ,\n");
- printf("The mode: 0=normal 1=thicken 2=gray 4=italic \n");
- printf(" 8=reverse 16=underline \n");
- printf("Most combinations work but some are weird(Useing exlinea1.prg).\n \n");
- }
-
- main()
- {
- int c,x,y,m;
- init_scr();
- init_msg();
- for(;;)
- {
- printf("\033A\033K> ");
- fflush(stdout);
- gets(line);
- if(!strcmp(line, "quit"))
- return(0);
- sscanf(line, "%d %d %d %d", &c, &x, &y, &m);
- put_scr(c, x, y, m);
- }
- }
-